package com.benmei.weike.dao;

import com.benmei.weike.entity.ReserveTime;
import com.benmei.weike.entity.Setmeal;
import com.benmei.weike.entity.TeacherAppointmentTime;
import com.benmei.weike.entity.reserve.TdNtReserveTimeList;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

import com.benmei.weike.entity.Appointment;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
@Mapper
public interface AppointmentDao {

    int insert(@Param("pojo") Appointment pojo);

    int insertSelective(@Param("pojo") Appointment pojo);

    int insertList(@Param("pojos") List<Appointment> pojo);

    int update(@Param("pojo") Appointment pojo);

    Appointment findConflictAppointmentForTeacher(@Param("tea_id") Integer tea_id, @Param("start_time")Date reserve_start_time, @Param("end_time")Date reserve_end_time);

    Appointment findConflictAppointmentForMember(@Param("memb_id") Integer memb_id, @Param("start_time")Date reserve_start_time, @Param("end_time")Date reserve_end_time);

    Setmeal findFirstExpireSetmeal(@Param("memb_id")Integer memb_id, @Param("cou_id")Integer cou_id);

    void updateAppointmentSize(@Param("set_reserve_size")int set_reserve_size, @Param("memb_set_id")Integer memb_set_id);

    void updateAppointmentTimeStatus(TeacherAppointmentTime appointmentTime);

    void updateTimeBlockStatus(TeacherAppointmentTime appointmentTime);

    ReserveTime findConflictReserveTimeForTeacher(@Param("tea_id") Integer tea_id, @Param("start_time")Date reserve_start_time, @Param("end_time")Date reserve_end_time,@Param("cou_time") Integer cou_time);

    List<ReserveTime> findReserveTime(@Param("tea_id") Integer tea_id, @Param("start_time") Date appointmentStartDate, @Param("end_time") Date appointmentEndDate);

    void addAppointmentTime(@Param("pojo") TeacherAppointmentTime teacherAppointmentTime);

    Integer findCourseReserveTimeForTeacher(@Param("tea_id") Integer tea_id, @Param("start_time")Date reserve_start_time, @Param("end_time")Date reserve_end_time);

    /**
     * @Purpose  查找教师可接单时间段
     * @version  3.0
     * @author   lizhun
     * @param    params
     * @return   List<TdNtReserveTimeList>
     */
    public List<TdNtReserveTimeList> findTdNtReserveTimeList(Map<String, Object> params);

    List<TeacherAppointmentTime> appointmentPreview(@Param("tea_id")Integer tea_id, @Param("start_data")Date start_data);

    ReserveTime findTimeBlock(@Param("tea_id")Integer tea_id, @Param("date")Date date);
}
